package com.dingqb.mycs.ui.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

import com.base.BaseActivity;
import com.dingqb.mycs.R;

public class HtmlActivity extends BaseActivity {

	private TextView tv_html;
	private TextView tv_build;
	String html = "<html><head><title>TextView使用HTML</title></head><body><p><strong>强调</strong></p><p><em>斜体</em></p>"
			+ "<p><a href=\"http://www.dreamdu.com/xhtml/\">超链接HTML入门</a>学习HTML!</p><p><font color=\"#aabb00\">颜色1"
			+ "</p><p><font color=\"#00bbaa\">颜色2</p><h1>标题1</h1><h3>标题2</h3><h6>标题3</h6><p>大于>小于<</p><p>"
			+ "下面是网络图片</p><img src=\"http://avatar.csdn.net/0/3/8/2_zhang957411207.jpg\"/></body></html>";

	@SuppressWarnings("\ndeprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_html);
		tv_html = (TextView) findViewById(R.id.tv_html);
		tv_build = (TextView) findViewById(R.id.tv_build);
		tv_html.setMovementMethod(ScrollingMovementMethod.getInstance());
		tv_html.setText(Html.fromHtml(html));
		tv_build.setText(app.getName()+"\n"+getDeviceInfo());
		System.out.println(app.getName());
	}

	/**
	 * 获取设备信息
	 * 
	 * @return
	 */
	@SuppressLint({ "\nNewApi", "NewApi" })
	private String getDeviceInfo() {
		StringBuffer sb = new StringBuffer();
		sb.append("\n主板:" + Build.BOARD);
		sb.append("\n系统启动程序版本号:" + Build.BOOTLOADER);
		sb.append("\n系统定制商:" + Build.BRAND);
		sb.append("\ncpu指令集:" + Build.CPU_ABI);
		sb.append("\ncpu指令集2:" + Build.CPU_ABI2);
		sb.append("\n设置参数:" + Build.DEVICE);
		sb.append("\n显示屏参数:" + Build.DISPLAY);
		sb.append("\nwww.2cto.com无线电固件版本:" + Build.getRadioVersion());
		sb.append("\n硬件识别码:" + Build.FINGERPRINT);
		sb.append("\n硬件名称:" + Build.HARDWARE);
		sb.append("\nHOST:" + Build.HOST);
		sb.append("\n修订版本列表:" + Build.ID);
		sb.append("\n硬件制造商:" + Build.MANUFACTURER);
		sb.append("\n版本:" + Build.MODEL);
		sb.append("\n硬件序列号:" + Build.SERIAL);
		sb.append("\n手机制造商:" + Build.PRODUCT);
		sb.append("\n描述Build的标签:" + Build.TAGS);
		sb.append("\nTIME:" + Build.TIME);
		sb.append("\nbuilder类型:" + Build.TYPE);
		sb.append("\nUSER:" + Build.USER);
		sb.append("\nSDK_INT:" + Build.VERSION.SDK_INT);
		sb.append("\nSDK:" + Build.VERSION.SDK);
		return sb.toString();
	}
}
